package com.linjj.seckill.controller;

import com.linjj.seckill.access.AccessLimit;
import com.linjj.seckill.service.IAddressService;
import com.linjj.seckill.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/address")
public class AddressController {
    @Autowired
    private IAddressService addressService;
    @AccessLimit(seconds = 5,maxCount = 5,needLogin = false)
    @GetMapping("/province")
    @ResponseBody
    public Result getProvinces(){
        return Result.success(addressService.getProvinces());
    }
    @AccessLimit(seconds = 5,maxCount = 5,needLogin = false)
    @GetMapping("/city")
    @ResponseBody
    public Result getCitys(long pid){
        return Result.success(addressService.getCitys(pid));
    }
}
